package com.tyut.mapper;

import com.github.pagehelper.Page;
import com.tyut.pojo.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ArticleMapper {
	//新增文章
	@Insert("insert into article (title, content, cover_img, state, category_id, create_user, create_time, update_time) values" +
			"  (#{title}, #{content}, #{coverImg}, #{state}, #{categoryId}, #{createUser}, #{createTime}, #{updateTime})")
	void insert(Article article);

	//查询文章列表
	Page<Article> list(Integer userId, Integer categoryId, String state,String checkState);

	//查询文章详情
	@Select("select * from article where id = #{id}")
	Article detail(Integer id);
	//修改文章
	void update(Article article);
	//删除文章
	@Delete("delete from article where id = #{id}")
	void delete(Integer id);

	Page<Article> authorlist(Integer categoryId, String state, String checkState);
}
